package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("api")
public class LoginController {

    @Autowired
    private LoginService loginService;
    @PostMapping("/login")
    public User login(@RequestBody User user) {
        System.out.println(user);
        return loginService.login(user);
    }
    @PostMapping("/student/login")
    public User studentLogin(@RequestBody User user) {
        System.out.println(user);
        return loginService.login(user);
    }
    @PostMapping("/teacher/login")
    public User teacherLogin(@RequestBody User user) {
        return loginService.login(user);
    }
}
